import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

class InputPage extends StatelessWidget {
  const InputPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final logic = Get.find<InputLogic>();
    final state = Get.find<InputLogic>().state;
    return Scaffold(
      appBar: AppBar(
        title: const Text("手写活字排列"),
        centerTitle: true,
      ),
      body: SafeArea(
          child: Column(
        children: [
          TextField(
            decoration: const InputDecoration(
                hintText: "请输入要生成的手写字体", contentPadding: EdgeInsets.all(10)),
            maxLines: 8,
            onChanged: (text) {
              state.text = text;
            },
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              ElevatedButton(onPressed: logic.check, child: const Text("检查")),
              ElevatedButton(
                  onPressed: logic.rewrite, child: const Text("重新录入")),
            ],
          ),
        ],
      )),
    );
  }
}
